package com.baorant.springboothelloworld.service;

import com.baorant.springboothelloworld.dao.UserMapper;
import com.baorant.springboothelloworld.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public String getNameByUsername(String _username) {
        User user= userMapper.selectByPrimaryKey(_username);
        if(user== null)
            return "";
        else {

            return user.getName();
        }
    }
}


